{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport { YEAR_DECADE_COUNT } from '.';\nimport useCellClassName from \"../../hooks/useCellClassName\";\nimport { formatValue, isSameYear } from \"../../utils/dateUtil\";\nimport RangeContext from \"../../RangeContext\";\nimport PanelBody from \"../PanelBody\";\nexport var YEAR_COL_COUNT = 3;\nvar YEAR_ROW_COUNT = 4;\nfunction YearBody(props) {\n  var prefixCls = props.prefixCls,\n    value = props.value,\n    viewDate = props.viewDate,\n    locale = props.locale,\n    generateConfig = props.generateConfig;\n  var _React$useContext = React.useContext(RangeContext),\n    rangedValue = _React$useContext.rangedValue,\n    hoverRangedValue = _React$useContext.hoverRangedValue;\n  var yearPrefixCls = \"\".concat(prefixCls, \"-cell\"); // =============================== Year ===============================\n\n  var yearNumber = generateConfig.getYear(viewDate);\n  var startYear = Math.floor(yearNumber / YEAR_DECADE_COUNT) * YEAR_DECADE_COUNT;\n  var endYear = startYear + YEAR_DECADE_COUNT - 1;\n  var baseYear = generateConfig.setYear(viewDate, startYear - Math.ceil((YEAR_COL_COUNT * YEAR_ROW_COUNT - YEAR_DECADE_COUNT) / 2));\n  var isInView = function isInView(date) {\n    var currentYearNumber = generateConfig.getYear(date);\n    return startYear <= currentYearNumber && currentYearNumber <= endYear;\n  };\n  var getCellClassName = useCellClassName({\n    cellPrefixCls: yearPrefixCls,\n    value: value,\n    generateConfig: generateConfig,\n    rangedValue: rangedValue,\n    hoverRangedValue: hoverRangedValue,\n    isSameCell: function isSameCell(current, target) {\n      return isSameYear(generateConfig, current, target);\n    },\n    isInView: isInView,\n    offsetCell: function offsetCell(date, offset) {\n      return generateConfig.addYear(date, offset);\n    }\n  });\n  return /*#__PURE__*/React.createElement(PanelBody, _extends({}, props, {\n    rowNum: YEAR_ROW_COUNT,\n    colNum: YEAR_COL_COUNT,\n    baseDate: baseYear,\n    getCellText: generateConfig.getYear,\n    getCellClassName: getCellClassName,\n    getCellDate: generateConfig.addYear,\n    titleCell: function titleCell(date) {\n      return formatValue(date, {\n        locale: locale,\n        format: 'YYYY',\n        generateConfig: generateConfig\n      });\n    }\n  }));\n}\nexport default YearBody;","map":{"version":3,"names":["_extends","React","YEAR_DECADE_COUNT","useCellClassName","formatValue","isSameYear","RangeContext","PanelBody","YEAR_COL_COUNT","YEAR_ROW_COUNT","YearBody","props","prefixCls","value","viewDate","locale","generateConfig","_React$useContext","useContext","rangedValue","hoverRangedValue","yearPrefixCls","concat","yearNumber","getYear","startYear","Math","floor","endYear","baseYear","setYear","ceil","isInView","date","currentYearNumber","getCellClassName","cellPrefixCls","isSameCell","current","target","offsetCell","offset","addYear","createElement","rowNum","colNum","baseDate","getCellText","getCellDate","titleCell","format"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/rc-picker/es/panels/YearPanel/YearBody.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport { YEAR_DECADE_COUNT } from '.';\nimport useCellClassName from \"../../hooks/useCellClassName\";\nimport { formatValue, isSameYear } from \"../../utils/dateUtil\";\nimport RangeContext from \"../../RangeContext\";\nimport PanelBody from \"../PanelBody\";\nexport var YEAR_COL_COUNT = 3;\nvar YEAR_ROW_COUNT = 4;\n\nfunction YearBody(props) {\n  var prefixCls = props.prefixCls,\n      value = props.value,\n      viewDate = props.viewDate,\n      locale = props.locale,\n      generateConfig = props.generateConfig;\n\n  var _React$useContext = React.useContext(RangeContext),\n      rangedValue = _React$useContext.rangedValue,\n      hoverRangedValue = _React$useContext.hoverRangedValue;\n\n  var yearPrefixCls = \"\".concat(prefixCls, \"-cell\"); // =============================== Year ===============================\n\n  var yearNumber = generateConfig.getYear(viewDate);\n  var startYear = Math.floor(yearNumber / YEAR_DECADE_COUNT) * YEAR_DECADE_COUNT;\n  var endYear = startYear + YEAR_DECADE_COUNT - 1;\n  var baseYear = generateConfig.setYear(viewDate, startYear - Math.ceil((YEAR_COL_COUNT * YEAR_ROW_COUNT - YEAR_DECADE_COUNT) / 2));\n\n  var isInView = function isInView(date) {\n    var currentYearNumber = generateConfig.getYear(date);\n    return startYear <= currentYearNumber && currentYearNumber <= endYear;\n  };\n\n  var getCellClassName = useCellClassName({\n    cellPrefixCls: yearPrefixCls,\n    value: value,\n    generateConfig: generateConfig,\n    rangedValue: rangedValue,\n    hoverRangedValue: hoverRangedValue,\n    isSameCell: function isSameCell(current, target) {\n      return isSameYear(generateConfig, current, target);\n    },\n    isInView: isInView,\n    offsetCell: function offsetCell(date, offset) {\n      return generateConfig.addYear(date, offset);\n    }\n  });\n  return /*#__PURE__*/React.createElement(PanelBody, _extends({}, props, {\n    rowNum: YEAR_ROW_COUNT,\n    colNum: YEAR_COL_COUNT,\n    baseDate: baseYear,\n    getCellText: generateConfig.getYear,\n    getCellClassName: getCellClassName,\n    getCellDate: generateConfig.addYear,\n    titleCell: function titleCell(date) {\n      return formatValue(date, {\n        locale: locale,\n        format: 'YYYY',\n        generateConfig: generateConfig\n      });\n    }\n  }));\n}\n\nexport default YearBody;"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,oCAAoC;AACzD,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,iBAAiB,QAAQ,GAAG;AACrC,OAAOC,gBAAgB,MAAM,8BAA8B;AAC3D,SAASC,WAAW,EAAEC,UAAU,QAAQ,sBAAsB;AAC9D,OAAOC,YAAY,MAAM,oBAAoB;AAC7C,OAAOC,SAAS,MAAM,cAAc;AACpC,OAAO,IAAIC,cAAc,GAAG,CAAC;AAC7B,IAAIC,cAAc,GAAG,CAAC;AAEtB,SAASC,QAAQ,CAACC,KAAK,EAAE;EACvB,IAAIC,SAAS,GAAGD,KAAK,CAACC,SAAS;IAC3BC,KAAK,GAAGF,KAAK,CAACE,KAAK;IACnBC,QAAQ,GAAGH,KAAK,CAACG,QAAQ;IACzBC,MAAM,GAAGJ,KAAK,CAACI,MAAM;IACrBC,cAAc,GAAGL,KAAK,CAACK,cAAc;EAEzC,I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